package com.orange.core.pojo.entity.category;

import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonView;
import com.orange.core.pojo.entity.IIntIdModel;
import com.orange.core.pojo.entity.IOperatorModel;
import com.orange.core.util.Constants;
import com.orange.core.validator.group.Update;
import com.orange.core.validator.view.Simple;
import com.orange.core.validator.view.SimpleWithId;
import lombok.Data;
import lombok.experimental.Accessors;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.time.LocalDateTime;

@Data
@Accessors(chain = true)
public class ProductCategory implements IIntIdModel<ProductCategory>, IOperatorModel<ProductCategory> {

    @JsonView(SimpleWithId.class)
    @NotNull(message = "请求参数不合法", groups = {Update.class})
    @TableId(type = IdType.AUTO)
    private Integer id;

    /**
     * 分类名
     */
    @JsonView(Simple.class)
    @NotBlank(message = "请输入分类名")
    private String name;

    @TableLogic
    private Long del;

    @JsonFormat(pattern = Constants.DEFAULT_DATE_FORMAT)
    private LocalDateTime createTime;

    @TableField(fill = FieldFill.INSERT)
    private Integer createBy;

    private LocalDateTime updateTime;

    @TableField(fill = FieldFill.INSERT_UPDATE)
    private Integer updateBy;
}
